<template>
  <div class="bill-category">
    <div class="currentOpaction">{{ title }}</div>
    <van-dropdown-menu class="dropdown-menu" :overlay="false">
      <van-dropdown-item
        @change="change"
        v-model="value"
        :options="billCategoryInfo.option"
      />
    </van-dropdown-menu>

  </div>
</template>

<script lang="js">
import {defineComponent, reactive, ref} from 'vue'

export default defineComponent({
  props: {
    billCategoryInfo:{
      type:Object,
      default(){
        return {}
      }
    }
  },
  components: {

  },
  setup(props) {
    const value=ref(0)
    const billCategoryInfo=ref(props.billCategoryInfo)
    const title=ref(billCategoryInfo.value.option[0].text)
    const change=(value)=>{
        const index=billCategoryInfo.value.option.findIndex(item=>item.value==value)
        title.value=billCategoryInfo.value.option[index].text
    }

    return {
      value,
      title,
      change
    }

  }
})
</script>

<style scoped lang="less">
.bill-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin:2vw 6vw 6vw 6vw;
  border-bottom: 1px dotted var(--van-white-color4);
  .currentOpaction{
    color: var(--van-theme-color);
  }
  &:deep(.van-ellipsis){
    font-size: 4.2vw;
  }
  &:deep(.van-dropdown-menu__bar) {
    box-shadow: none !important;
  }
  &:deep(.van-popup--top) {
    padding-left: 3vw !important;
  }
}
</style>
